home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5587 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.3 KB  |  93 lines

  1. Newsgroups: comp.lang.c++
  2. Path: EU.net!chsun!usenet
  3. From: rop@dial.eunet.ch@dial.eunet.ch
  4. Subject: Re: RW Tools.h++'s persistence - second try
  5. Message-ID: <DMBJ0H.FEq@eunet.ch>
  6. Sender: usenet@eunet.ch
  7. Reply-To: rop@dial.eunet.ch
  8. Organization: A customer of EUnet AG, Switzerland
  9. X-Newsreader: IBM NewsReader/2 v1.2.5
  10. References: <4e5h7q$sip@rc1.vub.ac.be>
  11. Date: Mon, 5 Feb 1996 19:48:16 GMT
  12.  
  13. In <4e5h7q$sip@rc1.vub.ac.be>, kpgoderi@etro3 (Karel Goderis) writes:
  14. >Ugh... some newsreaders suck - here is the posting
  15. >
  16. >
  17. >Watch this small piece of code, and then the warnings I get when 
  18. >compiling the code. The persistence machinary do write the stuff in a 
  19. >decent way, but reading  messes up.
  20. >
  21. >class Coordinate : public RWCollectable {
  22. >
  23. >  RWDECLARE_COLLECTABLE(Coordinate)
  24. >
  25. >public:
  26. >  Coordinate();
  27. >
  28. >  int x;
  29. >  int y;
  30. >
  31. >  //From RwCollectable - for persistence
  32. >  virtual void restoreGuts(RWFile& f);
  33. >  virtual void restoreGuts(RWvistream& strm);
  34. >  virtual void saveGuts(RWFile& f) const;
  35. >  virtual void saveGuts(RWvostream& strm) const;
  36. >
  37. >};
  38. >
  39. >
  40. >here follows the code for the persistence stuff . I omitted a lot of the code
  41. >
  42. >
  43. >void Coordinate::restoreGuts(RWvistream& strm)
  44. >{
  45. >  RWCollectable::restoreGuts(strm);
  46. >
  47. >  strm >> x;   // this is line 1144 of the error report
  48. >  strm >> y;
  49. >
  50. >}
  51. >
  52. >
  53. >
  54. >.... and  the error of the compiler
  55. >
  56. >
  57. >"ROI.cc", line 1144: Warning (Anachronism): Temporary created for 
  58. >argument cstr in call to operator>>(RWvistream&, RWCString&).
  59. >"ROI.cc", line 1145: Warning (Anachronism): Temporary created for 
  60. >argument cstr in call to operator>>(RWvistream&, RWCString&).
  61. >
  62. >
  63. >.... which makes that every read results in a (-1,-1) coordinate, and that 
  64. >is not actually the goal of it :) 
  65. >
  66. >--
  67. > Karel Goderis
  68. >
  69. > VUB - Vrije Universiteit Brussel 
  70. >  Personal         --- kpgoderi@etro.vub.ac.be 
  71. >
  72. > IGUANA - Indepent Group of Unix-alikes and Networking activists 
  73. >  Personal                --- scollie@medelec.uia.ac.be 
  74. >
  75. > BEST - Board of European Students of Technology 
  76. >  General              --- twbest00@vub.ac.be  
  77.  
  78. I can remeber we had the same problem, but try this (I am going to check
  79. tomorrow if my memory failed or not):
  80.  
  81. {
  82.     strm >> (int&) x;
  83.     strm >> (int&) y;
  84.     
  85. }
  86.  
  87. ROTZETTER Patrick (rop@dial.eunet.ch)
  88. Deutsche Bank (Suisse) S.A.
  89. Voice:+41 22 7390588
  90. Fax:+41 22 7390386
  91.  
  92.